#ifndef ENGINE_H
#define ENGINE_H

#ifdef OSX
#include <GLUT/glut.h>
#include <OpenGL/glu.h>
#else
#include <GL/glut.h>
#include <GL/glu.h>
#endif

#include "character.h"
#include "magic.h"

#define PI 3.14159265
#define maxSpells 5

// CLASSES

class Viewport {
public:
    int w, h; // width and height
	
	Viewport(){
		w = 400;
		h = 400;
	}
};

class Camera {
public:
    float angle,lx,lz,x,y,z;
    float floorHeight;
	
	Camera(){
		angle = 0.0f;
		x     = 0.0f;
		y     = 5.5f;
		z     = 5.0f;
		lx    = 0.0f;
		lz    = -1.0f;
		floorHeight = 5.0f;
	}
};

//global vars
extern float        currentTime;
extern Camera       camera;

// FUNCTIONS
void myReshape(int w, int h);
void initLight();
void initScene();

void renderBitmapString(float x,float y,float z,void *font,char *string);
void renderStrokeFontString(float x, float y, float z, void *font, char *string);
void restorePerspectiveProjection();
void setOrthographicProjection();

void computePosition();
void computeJump();
void computeStrafe();

void loadFloor();

float euclidianDistance(float x1,float y1,float z1,float x2,float y2,float z2);

void myDisplay();
void myFrameMove();

void processNormalKeys(unsigned char key, int x, int y);
void processSpecialKeys(int key, int x, int y);
void releaseKey(unsigned char key, int x, int y);
void mouseMove(int x, int y);
void mouseButton(int button, int state, int x, int y);

Camera getCamera();

#endif